Overlay
fun Overlay(_: Nothing = nothing, backHandler: @Composable () -> Unit = {
val isBackHandlerEnabled by remember {
combine(
editorContext.engine.editor.onHistoryUpdatedWithKind().map {
editorContext.engine.editor.canUndo()
},
editorContext.state.map { it.isBackHandlerEnabled },
) { canUndo, isBackHandlerEnabled ->
canUndo && !isBackHandlerEnabled
}
}.collectAsState(false)
BackHandler(isBackHandlerEnabled) {
editorContext.eventHandler.send(EditorEvent.OnClose())
}
}, loading: @Composable () -> Unit = {
if (showLoading) {
Loading()
}
}, errorDialog: @Composable () -> Unit = {
this@BasicConfigurationBuilder.error?.let {
ErrorDialog(throwable = it)
}
}, closeConfirmationDialog: @Composable () -> Unit = {
if (showCloseConfirmationDialog) {
CloseConfirmationDialog()
}
}, __: Nothing = nothing)
A helper function that renders the overlay based on showLoading, showCloseConfirmationDialog and error state objects.
Parameters
back Handler
the back handler logic.
loading
the loading overlay logic.
error Dialog
the error dialog logic.
close Confirmation Dialog
the close confirmation dialog logic.